package com.dy.dao;

import com.dy.bean.Sugar;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SugarDao {
    @Select("SELECT b2.`name`,sum(o.final_total_amount)'value' FROM order_info o \n" +
            "LEFT JOIN order_detail d on o.id = d.order_id\n" +
            "LEFT JOIN sku_info s on d.sku_id = s.id\n" +
            "LEFT JOIN base_category3 b3 on s.category3_id = b3.id\n" +
            "LEFT JOIN base_category2 b2 on b3.category2_id = b2.id\n" +
            "GROUP BY b2.`name`")
    List<Sugar> showTwo();
    @Select("SELECT t.`name`,sum(o.final_total_amount)'value' FROM order_info o \n" +
            "LEFT JOIN order_detail d on o.id = d.order_id\n" +
            "LEFT JOIN sku_info s on d.sku_id = s.id\n" +
            "LEFT JOIN base_trademark t on s.tm_id = t.id\n" +
            "GROUP BY t.name ")
    List<Sugar> showPp();
    @Select("call sp6")
    Double showNum();
    @Select("SELECT p.spu_name'name',sum(o.final_total_amount)'value' FROM order_info o \n" +
            "LEFT JOIN order_detail d on o.id = d.order_id\n" +
            "LEFT JOIN sku_info s on d.sku_id = s.id\n" +
            "LEFT JOIN spu_info p on s.spu_id = p.id\n" +
            "GROUP BY p.spu_name")
    List<Sugar> showSpu();
}
